<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <title>
                一个网页
            </title>
            <link href="layui/css/layui.css" rel="stylesheet" type="text/css"/>
            <script src="layui/layui.js" type="text/javascript">
            </script>
        </meta>
    </head>
    <body>
        <button type="button" class="layui-btn" id="test1">
            <i class="layui-icon">&#xe67c;</i>上传图片
        </button>
        <script>
            layui.use('upload', function(){
                var upload = layui.upload;

                //执行实例
                var uploadInst = upload.render({
                    elem: '#test1', //绑定元素
                    field: 'files',
                    url: 'http://localhost:8086/bweixin/v1.0/util/upload', //上传接口
                    multiple: true,
                    done: function(res){
                        //上传完毕回调
                        console.log(res);
                    },
                    error: function(err){
                        //请求异常回调
                        console.log(err);
                    }
                });
            });
        </script>
    </body>
</html>